import React, {Component} from 'react';
import {Button, Avatar, Menu, Icon, Layout} from 'antd';
// 蚂蚁金服属性定义
const {Sider} = Layout;

export default class Admin_menu extends Component {
    constructor(props) {
        super(props);
        this.state = {
            collapsed: false,
            choose_num: this.props.choose
        }
    }

    onChangekey = (e) => {
        this.props.onChange(e.key);
    };

    render() {

        return (
            <Sider
                style={{overflow: 'auto'}}
                trigger={null}
                collapsible
                collapsed={this.state.collapsed}
                breakpoint="lg"
                // collapsedWidth="0"
                onCollapse={(collapsed, type) => {
                    console.log(collapsed, type);
                }}
            >
                <div className="logo">
                    <div className="display" style={{display: 'flex', justifyContent: 'center'}}>
                        <Avatar style={{backgroundColor: '#87d068'}} icon="user" size="large"/>
                    </div>
                    <div style={{color: 'orange', textAlign: 'center', position: 'relative'}}>USER</div>
                    <div style={{textAlign: 'center', marginTop: 5}}>
                        <Button type="primary" icon="logout" size="small" onClick={()=>window.location.href = "/"}>退出</Button>
                    </div>
                </div>
                <Menu theme="dark" mode="inline" defaultSelectedKeys={['0']}
                      onSelect={this.onChangekey}>
                    <Menu.Item key="0">
                        <Icon type="appstore"/>
                        <span className="nav-text">参考案例集锦</span>
                    </Menu.Item>
                    <Menu.Item key="1">
                        <Icon type="notification"/>
                        <span className="nav-text">发表论文</span>
                    </Menu.Item>
                    <Menu.Item key="2">
                        <Icon type="file-add"/>
                        <span className="nav-text">专利</span>
                    </Menu.Item>
                    <Menu.Item key="3">
                        <Icon type="file-text"/>
                    <span className="nav-text">软件下载</span>
                    </Menu.Item>
                </Menu>
            </Sider>

        )
    }
}

